<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    #test{
        width:100px;
        background:red;
    }
    </style>
</head>
<body>
    <div id="test" style="height:100px;"></div>
    <script>
    // string-->number;
   /*  parseInt();
   parseFloat();
   tip:第一位必须为数字
     */
     var test=document.getElementById("test");
     var height=test.style.height;
     console.log(parseInt(height));
     test.onclick=function(){
         this.style.height=parseInt(this.style.height)+1+"px";
     }
     var a="12px";
     var b="a13px";
     var c="13.45px";
     console.log(parseInt(a));
     console.log(parseInt(b));
     console.log(parseInt(c));
     console.log(parseFloat(c));
    </script>
</body>
</html>